var DBFactory = require('../conn/DBFactory');
var CMSDao = module.exports;

CMSDao.expiredCMSStatus = function(cb) {
    var sql = 'update personal_site set `status` = 0 where now() > DATE_ADD(`created_date`,INTERVAL 30 DAY)';
    DBFactory.getConnection(function(error, connection){
        if(error) {
            cb(error);
            return;
        } else {
            connection.query(sql, [], function (err, result) {
                var rows = {};
                rows.expiredCMS = result.affectedRows;
                cb(err, rows);
                connection.release();
            });
        }
    });
}